package cn.tedu.ivos2.geofence.controller;

import cn.tedu.ivos2.base.response.JsonResult;
import cn.tedu.ivos2.geofence.pojo.dto.GeofenceQuery;
import cn.tedu.ivos2.geofence.pojo.dto.GeofenceSaveParam;
import cn.tedu.ivos2.geofence.pojo.vo.GeofenceVO;
import cn.tedu.ivos2.geofence.service.GeofenceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/geofence")
public class GeofenceController {
    @Autowired
    private GeofenceService geofenceService;
    @GetMapping("queryGeofence")
    public JsonResult queryGeofence(GeofenceQuery geofenceQuery) {
        List<GeofenceVO> list = geofenceService.queryGeofence(geofenceQuery);
        return JsonResult.ok(list);
    }
    @PostMapping("delete/{id}")
    public JsonResult deleteGeofence(@PathVariable Long id) {
        geofenceService.deleteGeofence(id);
        return JsonResult.ok();
    }
    @PostMapping("save")
    public JsonResult saveGeofence(GeofenceSaveParam geofenceSaveParam) {
        geofenceService.saveGeofence(geofenceSaveParam);
        return JsonResult.ok();
    }
}
